package com.clkj.xiuzheng.dao.shangcheng;

import com.clkj.xiuzheng.pojo.shangcheng.Notice;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface NoticeMapper extends Mapper<Notice> {

    @Select("select top 1 * from t_xz_notice where " +
            "user_type in (#{userType},-1) " +
            "and company_id in (0,#{companyId}) " +
            "and is_release = 1 " +
            "and datediff(hour,release_time,getDate()) >0 " +
            "order by notice_id desc ")
    Notice getNotice(Integer userType, Integer companyId);

    @Select("select * from t_xz_notice where " +
            "user_type in (#{userType},-1) " +
            "and company_id in (0,#{companyId}) " +
            "and is_release = 1 " +
            "and datediff(hour,release_time,getDate()) >0 " +
            "and notice_status = 1 "+
            "order by notice_id desc ")
    List<Notice> listNotice(Integer userType, Integer companyId);
}
